<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>{{$SEO['title']}}</title>
    <meta name="keywords" content="{{$SEO['keywords']}}"/>
    <meta name="description" content="{{$SEO['description']}}"/>
    <!--公用css引用-->
    @include('front.common.style')
            <!--END/公用css引用-->
    <link rel="stylesheet" href="../dist/css/index.css">
</head>
<body>
<!--公共头部-->
@include('front.common.header')

        <!--END/公共头部-->

@inject('recommendPositionService','App\Interfaces\RecommendPositionService')
@inject('goodsService','App\Interfaces\GoodsService')
@inject('shopService','App\Interfaces\ShopService')
@inject('pictureService','App\Interfaces\PictureService')
@inject('userCollectionService','App\Interfaces\UserCollectionService')

@inject('adService','App\Interfaces\AdService')
@inject('categoryService','App\Interfaces\CategoryService')
        <!--banner图-->
<div class="banner fn-rel">
<?php //if($adPosition){dd("dafdf");}else{dd("dfagghhfg");}//dd($adPosition);?>
    <ul id="js-banner" class="rslides">
    @if($adPosition)
        @foreach($adService->get('cat_focus_'.$cat->cat_id) as $ad)
            <li><a class="fn-clear img" href="{{$ad->url}}" style="background: url('{{$pictureService::thumb($ad->image)}}') no-repeat center;"></a></li>
        @endforeach
    @else
        @foreach($adService->get('index_focus') as $ad)
            <li><a class="fn-clear img" href="{{$ad->url}}" style="background: url('{{$pictureService::thumb($ad->image)}}') no-repeat center;"></a></li>
        @endforeach
    @endif
    </ul>
    <div class="inbox rslides-nav"></div>
</div>
<!--END/banner图-->


<!--基本护肤-->

@foreach($cat->getChildren() as $k=>$category)
<?php $catGoods = $goodsService->getCatGoods($category->cat_id,8,0);?>
@if ($catGoods->count()>0)
<div class="inbox">
    <div class="panel-head tit-1 fn-mt30">
        <h1 class="h text-color-7"><i class="icon icon-08"></i>{{$category->cat_name}}</h1>
        @if ($category->getChildren()->count()>0)
        <p class="more link-list link-list-skin1">
            @foreach($category->getChildren()->take(5) as $child)
            <a href="/cat/{{$child->cat_id}}?cat_id={{$child->cat_id}}" target="_blank" class="small text-color-7">{{$child->cat_name}} <span class="borr"></span></a>
            @endforeach
            <a href="/cat/{{$category->cat_id}}" target="_blank" class="small text-color-7">查看更多</a>
        </p>
        @endif
    </div>
    <div class="panel-body">
        <ul class="imglist-2 ui-cols-4 imglist-2-ver imglist-skin-2">
            @foreach($catGoods as $goods)
                <?php
                $shop= $shopService->get($goods->shop_id);
                $goodsInCollection=isset($user)?$userCollectionService->isInCollection($user->id,'GOODS',$goods->goods_id):false;
                ?>
            <li class="col col-space">
                <div class="col-box">
                    <div class="col-l">
                        <a href="/goods/{{$goods->goods_id}}" target="_blank" title="{{$goods->goods_name}}">
                            <img class="lazy img-lazyload" data-src="{{$pictureService::thumb($goods->goods_thumb,254,254)}}" alt="{{$goods->goods_name}}">
                        </a>

                        @if($goods->goods_number==0)
                            <i class="icon icon-soldout"></i>
                        @endif
                    </div>
                    <div class="col-r">
                        <div class="panel-body">
                            @if($goodsInCollection)
                                <a href="javascript:;" class="fav-link fav"><i class="icon icon-fav"></i>已收藏</a>
                            @else
                                <a href="javascript:;" class="J-add-collection fav-link" reference_id="{{$goods->goods_id}}" collection-type="GOODS"><i class="icon icon-noFav"></i>收藏</a>
                            @endif

                            <p>
                                <span class="text-color-1 font-14 fn-mr4">￥<span class="font-24">{{$goods->shop_price}}</span></span>
                                @if($goods->shop_price>=60)
                                    <span class="bl-label label-brd-red fn-mb8">包邮</span>
                                @endif
                                <del class="fn-fr font-14 fn-mt6 fn-hide">￥{{$goods->market_price}}</del>
                            </p>
                            <a class="tit link fn-dib-otw ui-100" href="/goods/{{$goods->goods_id}}" target="_blank" title="{{$goods->goods_name}}">{{$goods->goods_name}}</a>
                            <p class="sub-tit fn-dib-otw" title="{{$goods->goods_pet_name}}">{{$goods->goods_pet_name}}&nbsp;</p>
                            <p>
                                @if($shop->shop_name=='阿福易购')
                                    <a href="/shop/{{$goods->shop_id}}" target="_blank">{{$shop->shop_name}}</a><span class="bl-label fn-ml4">自营</span>
                                @else
                                    <a href="/shop/{{$goods->shop_id}}" target="_blank">{{$shop->shop_name}}旗舰店</a>
                                @endif
                            </p>
                            <a href="javascript:;" data-id="{{$goods->goods_id}}" class="J-add-cart cart-link" title="加入购物车"><i class="icon icon-cart1"></i></a>
                        </div>
                    </div>
                </div>
            </li>
            @endforeach

        </ul>
    </div>
</div>
@endif
@endforeach
<!--END/基本护肤-->





<!--右侧浮动导航-->
<!-- @include('front.common.right-sidebar') -->
<!--END/右侧浮动导航-->

<!--公共尾部-->
@include('front.common.footer')

<!--END/公共尾部-->


<!--公用js引用-->
@include('front.common.script')

<!--END/公用js引用-->

<script src="../dist/js/responsiveslides.min.js"></script>
<script src="../dist/js/home.js"></script>
</body>
</html>